/**
* Class to manage a generic field properties
*
* Project: idbCrownInServer
* Author:  TM
* Date:    07/04/2013
*
* History
* ------------------
* 07/04/2013 - TM - Initial version.
*/
 
 
package DataModel;

import java.sql.*;
import java.util.TimeZone;
import java.text.*;

public class libDoubleField extends libField
{
   /** Constructor */
   public libDoubleField (String name)
   {
	    this(name, false);
   }

   /** Constructor */
   public libDoubleField (String name, boolean key)
   {
	    super(name, key);
   }
   
   /** public assign value into prepareStatement */
   public void assignValue(int index, PreparedStatement pst) throws Exception
   {
     Object  sourceValue = getValue();
     double  result      = 0;
     
     try
     {
       result = (sourceValue == null) ? 0 : Double.parseDouble(sourceValue.toString());
     }
     catch(Exception e)
     {
       debug("Error parsing date:"+sourceValue+" Used:"+result);     
     }
     
     pst.setDouble(index, result);
   }
   
}
